import wxRequest from '@/utils/wxRequest'
import store from '@/store'

export function getUserOpenidByCodeAPI(code) {
  return wxRequest({
    url: '/auth/get-openid/',
    method: 'post',
    data: {
      code
    }
  })
}

export function getUserUnionidByCodeAPI(hostname, code) {

  return wxRequest({
    url: '/auth/get-user-unionid/' + hostname + '/',
    method: 'post',
    data: {
      code
    }
  })
}

export function mergeUserByCodeAPI(code, scope) {
  return wxRequest({
    url: '/auth/merge-user/',
    method: 'post',
    data: {
      code,
      scope
    }
  })
}

export function getUserInfoDetailAPI() {
  
  return wxRequest({
    url: '/api/user-info-detail/',
    method: 'post',
    data: {
      openid: store.getters.userInfo.openid
    }
  })
}
